import EventManager from './event.js';

class LoadingManager {
    constructor(){
        this.gameState = 'loading'; // loading, ready, playing
        this.loadingProgress = 0;
    }

    setGameState(gameState) {
        const oldState = this.gameState;
        this.gameState = gameState;
        
        // 当状态改变时通过 EventManager 发送事件
        if (oldState !== gameState) {
            EventManager.emit('gameStateChange', { gameState });
        }
    }
    
    getGameState() {
        return this.gameState;
    }

}

export default LoadingManager;